#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/6/23 0023 23:03
# @Author  : wzy
# @Site    : 
# @File    : operate_mysql.py
# @Software: PyCharm
from  Util.operate_pathUrll import pathinfo
from Util.operate_config import ope_config
import pymysql
host=ope_config.get_config_value('host','database')
port=ope_config.get_config_value('port','database')
user=ope_config.get_config_value('user','database')
passwd=ope_config.get_config_value('passwd','database')
database=ope_config.get_config_value('database','database')


def link_database_mysql():
    db = pymysql.connect(host=host, port=int(port), user=user,password = passwd, db = database, charset = "utf8")
    cursors = db.cursor()
    # 执行sql
    sql = "show variables like '%time_zone%'"

    cursors.execute(sql)
    #获取所有数据
    accept_data = cursors.fetchall()
    print(accept_data)

    cursors.close()
    db.close()






if __name__ == '__main__':
    print(host)
    print(port)
    print(user)
    print(passwd)
    print(database)
    link_database_mysql()
    pass